<div class="book-summary">
    <div class="book-summary-home" id="js-summary-home">
        <a>
            <span class="icon_home_s icon_dev"></span>
            <span class="s_title_2">接口文档</span>
        </a>
    </div>
    <nav role="navigation">
        
        <ul class="summary">
        <volist name="nav1" id="c">
            <li class="chapter close " data-level="1.3.1" data-name="">
                <a href="javascript:;" data-id="{$key}" class='wai_data'>
                    {$c.t_name}
                    <if condition="$c.t_name_count neq '0' ">
                        <i class="fa fa-coffee" style="color:red;font-size: 12px;">({$c.t_name_count})</i>
                    </if>
                </a>
                <ul class="articles">
                    <volist name="c.child" id="api">
                        <li class="chapter son_li" data-name="view"><!-- active-->
                            <a data-id="{$api.id}" href="{:U('Doc/index')}?id={$api.id}&proid={$api.proid}">
                                {$api.title}
                                <if condition="$api.is_read eq '0' ">
                                    <i class="fa fa-coffee" style="color:red;font-size: 12px;"></i>
                                </if>
                            </a>
                        </li>
                    </volist>
                </ul>
            </li>
        </volist>
        </ul>
    </nav>
</div>
<script>
        $(function(){
            $("body").on('click','.wai_data',function(){
                var havclose = $(this).parent().hasClass("close");
                if(havclose){
                    $(this).parent().removeClass("close");
                    $(this).parent().addClass("open active");
                    $(this).parent().siblings().removeClass("active");
                }else{
                    $(this).parent().removeClass("open active");
                    $(this).parent().addClass("close");
                }
            });
            $("body").on('click','.son_li',function(){
                var havclose = $(this).hasClass("active");
                if(!havclose){
                    $(".son_li").removeClass("active");
                    $(this).addClass("active");
                }
            });
        })
       </script>
<script type="text/javascript">
        $(document).ready(function(){
            var t_id='{$data.type_id}';//当前接口类别id
            if(t_id!=''){
                $('.wai_data[data-id="'+t_id+'"]').parent().addClass("open active");
                $('.wai_data[data-id="'+t_id+'"]').parent().removeClass("close");
            }

            //当前接口id
            var api_id='{:I("id")}';
            if(api_id!=''){
                $('.son_li').find("a[data-id="+api_id+"]").parent().addClass("active");;
            }
            
        });
        
    </script>